package com.cwnu.onlinemall.service;

import com.cwnu.onlinemall.mapper.MallStaffMapper;
import com.cwnu.onlinemall.pojo.MallStaff;
import com.cwnu.onlinemall.pojo.MallStaffExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StaffServiceImpl implements StaffService{
    @Autowired
    MallStaffMapper mallStaffMapper;


    /*@Override
    public MallStaff login(MallStaff mallStaff) {
        MallStaffExample mallStaffExample=new MallStaffExample();
        MallStaffExample.Criteria criteria=mallStaffExample.or();
        criteria.andNameEqualTo(mallStaff.getName());
        criteria.andPasswordEqualTo



        List<MallStaff> list = userMapper.selectByExample(userExample);
        if(list.size()>=1){
            return list.get(0);
        }
        return null;
    }**/

    @Override
    public Integer updateById(MallStaff mallStaff) {
        return mallStaffMapper.updateByPrimaryKeySelective(mallStaff);
    }

    @Override
    public Integer deleteById(Integer id) {
        return mallStaffMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<MallStaff> selectAll() {
        return mallStaffMapper.selectByExample(null);
    }

    @Override
    public MallStaff selectById(Integer id) {
        MallStaff mallStaff = mallStaffMapper.selectByPrimaryKey(id);
        return mallStaff;
    }

    @Override
    public Integer insert(MallStaff mallStaff) {
        int insertRow = mallStaffMapper.insertSelective(mallStaff);
        return insertRow;
    }
}
